﻿@{
                @using YiSha.Entity.Business;
                            @using YiSha.Util.Extension;
                                        @using YiSha.Enum.OrganizationManage; Layout = "~/Views/Shared/_FormWhite.cshtml"; }

<div class="wrapper animated fadeInRight">
    <form id="form" class="form-horizontal m">
       
        <div class="form-group">
            <label class="col-sm-3 control-label">结束治疗说明</label>
            <div class="col-sm-8">
                <textarea id="endExplain" rows="10" cols="4" col="EndExplain" class="form-control"></textarea>
            </div>
        </div>
    </form>
</div>

<script type="text/javascript">
    var id = ys.request("id");
    $(function () {


        laydate.render({
            elem: '#birthday'
        });


        getForm();

        $("#form").validate({
            rules: {
                personName: { required: true }
            }
        });


    });

    function getForm() {




        if (id > 0) {
            ys.ajax({
                url: '@Url.Content("~/Prescription/GetFormJson")' + '?id=' + id,
                type: "get",
                success: function (obj) {
                    if (obj.Tag == 1) {
                        var result = obj.Data;
                        $("#form").setWebControls(result);
                    }
                }
            });
        }

    }

    function saveForm(index) {
        if ($("#form").validate().form()) {

            var postData = $("#form").getWebControls({ Id: id });
            postData.Id = id;
            ys.ajax({
                url: '@Url.Content("~/Prescription/SaveEndJson")',
                type: "post",
                data: postData,
                success: function (obj) {
                    if (obj.Tag == 1) {
                        ys.msgSuccess(obj.Message);
                        parent.searchGrid();
                        parent.layer.close(index);
                    }
                    else {
                        ys.msgError(obj.Message);
                    }
                }
            });
        }
    }
</script>
